var http=require('http');
var url=require('url');
var path=require('path');

//create server
var server = http.createServer(function(req, res){
	//get request path\
	var pathname = url.parse(req.url).pathname;
	res.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'});
	
	//access http://localhsot:8060/ return {"index": "welcome to home page"})
	if(pathname === '/'){
		res.end(JSON.stringify({"index": "welcome to home page"}));
	}
	else if(pathname === '/health.json'){
		res.end(JSON.stringify({"status": "UP"}));
	}
	
});

server.listen(8060, function(){
	console.log('listening on localhost:8060');
})